﻿namespace ReportGenerator
{
    public class SpendReportGenerator : IReportGenerator
    {
        private readonly IDateGenerator _dateGenerator;
        private readonly IDescriptionGenerator _descriptionGenerator;
        private readonly IReportNumberGenerator _reportNumberGenerator;
        private readonly ISpendRecordsGenerator _spendRecordsGenerator;

        public SpendReportGenerator(IDateGenerator dateGenerator, IDescriptionGenerator descriptionGenerator, IReportNumberGenerator reportNumberGenerator, ISpendRecordsGenerator spendRecordsGenerator)
        {
            _dateGenerator = dateGenerator;
            _descriptionGenerator = descriptionGenerator;
            _reportNumberGenerator = reportNumberGenerator;
            _spendRecordsGenerator = spendRecordsGenerator;
        }

        public Report Generate()
        {
            var newReport = new SpendReport
            {
                Date = _dateGenerator.Generate(),
                Description = _descriptionGenerator.Generate(),
                Number = _reportNumberGenerator.Generate(),
                SpendRecords = _spendRecordsGenerator.Generate()
            };

            return newReport;
        }
    }
}